package soft863.com.mr3;

import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class sort_mp extends Mapper<LongWritable, Text,DoubleWritable, Text> {
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String line = value.toString();
        String[] s = line.split(",");
        double rate = Double.parseDouble(s[s.length - 2]);
        context.write(new DoubleWritable(rate),new Text(s[0]));
    }
}